package com.cn.zpark;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 获取servletConfig对象
 */
@WebServlet("/sc1.do")
public class ServletConfigDemo01 extends HttpServlet {

    // 定义config对象
    private ServletConfig config;

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.err.println(config);
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        this.config = config;
    }
}
